<!DOCTYPE html>
<html>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width,initial-scale=1.0'>
    <meta http-equiv='X-UA-Compatible' content='ie=edge'>
    <title>Document</title>
</head>

<body>
    <div id='app'>
        <input v-focus>
    </div>
    <script src='./vue.js'></script>
    <script>
        // 局部自定义指令
        // 1. 通过选项directives:{}设置自定义指令
        // 2. 自定义指令名:{inserted(el){}}
        // 3. 使用自定义指令v-自定义指令名
        new Vue({
            el: '#app',
            data: {

            },
            directives: {
                'focus': {
                    inserted(el) {
                        el.focus();
                    }
                }
            },
            methods: {

            }
        });
    </script>
</body>

</html>